package com.teng.smartdrawer;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;


/**
 * Created by teng on 16/2/19.
 */
public class BaseActivity extends FragmentActivity implements View.OnClickListener {
    protected TextView actionbar_title;
    protected ImageView actionbar_back , actionbar_search;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initView();
    }



    public void initView(){
        setContentView(setLayoutId());
        actionbar_back = (ImageView) findViewById(R.id.actionbar_back);
//        actionbar_search = (ImageView) findViewById(R.id.actionbar_search);
        actionbar_back.setOnClickListener(this);
//        actionbar_search.setOnClickListener(this);
        actionbar_title = (TextView) findViewById(R.id.actionbar_title);
        actionbar_title.setText(setTitle());
    }

    public int setLayoutId(){
        return 0;
    }

    public String setTitle(){
        return "...";
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.actionbar_back :
                this.finish();
                break;
//            case R.id.actionbar_search:
//                Intent intent = new Intent(this , SearchActivity.class);
//                startActivity(intent);
//                break;
            default:
                break;
        }
    }
}
